function GetReportLine() {

	var myData = [
			['1', "2011-11-01 12:00:00", "产线1",'100','99','99%','未完成'],
			['2', "2011-11-02 12:00:00", "产线2",'200','180','90%','未完成'],
			['3', "2011-11-03 12:00:00", "产线3",'100','99','99%','未完成'],
			['4', "2011-11-04 12:00:00", "产线4",'100','99','99%','未完成'],
			['5', "2011-11-05 12:00:00", "产线5",'100','99','99%','未完成']

	];


	var store = new Ext.data.ArrayStore({
				fields : [{
							name : 'id'
						}, {
							name : 'time'
						}, {
							name : 'name'
						}, {
							name : 'jihua'
						}, {
							name : 'wancheng'
						}, {
							name : 'baifengbi'
						}, {
							name : 'status'
						}]
			});
			
	store.loadData(myData);
	
	var sm = new Ext.grid.CheckboxSelectionModel();
	var grid = new Ext.grid.GridPanel({
				store : store,
				columns : [sm, {
							id : 'id',
							header : 'id',
							width : 10,
							sortable : true,
							dataIndex : 'id',
							hidden : true
						}, {
							header : '时间',
							width : 150,
							sortable : true,
							dataIndex : 'time'
						}, {
							header : '产线',
							width : 100,
							sortable : true,
							dataIndex : 'name'
						}, {
							header : '计划数',
							width : 70,
							sortable : true,
							dataIndex : 'jihua'
						}, {
							header : '完成数',
							width : 70,
							sortable : true,
							dataIndex : 'wancheng'
						}, {
							header : '完成百分比',
							width : 100,
							sortable : true,
							dataIndex : 'baifengbi'
						}, {
							header : '完成情况',
							width : 100,
							sortable : true,
							dataIndex : 'status'
						}],
				sm : sm,
			
				
				stripeRows : true,
				autoExpandColumn : 'id',
				stateful : true,
				stateId : 'natnowgrid'
			});



	var Store1 = new Ext.data.JsonStore({
				fields : ['name', 'usage'],
				data : [{
							name : '09-01',
							usage : 5
						}, {
							name : '09-02',
							usage : 10
						}, {
							name : '09-03',
							usage : 20
						}, {
							name : '09-04',
							usage : 30
						}, {
							name : '09-05',
							usage : 20
						}, {
							name : '09-06',
							usage : 50
						}, {
							name : '09-07',
							usage : 20
						}, {
							name : '09-08',
							usage : 10
						}, {
							name : '09-09',
							usage : 10
						}, {
							name : '09-10',
							usage : 10
						},{
							name : '09-11',
							usage : 5
						}, {
							name : '09-12',
							usage : 10
						}, {
							name : '09-13',
							usage : 20
						}, {
							name : '09-14',
							usage : 30
						}, {
							name : '09-15',
							usage : 20
						}, {
							name : '09-16',
							usage : 50
						}, {
							name : '09-17',
							usage : 20
						}, {
							name : '09-18',
							usage : 10
						}, {
							name : '09-19',
							usage : 10
						}, {
							name : '09-20',
							usage : 10
						}]
		})

	var Store2 = new Ext.data.JsonStore({
				fields : ['name', 'usage'],
				data : [{
							name : '09-01',
							usage : 5
						}, {
							name : '09-02',
							usage : 10
						}, {
							name : '09-03',
							usage : 20
						}, {
							name : '09-04',
							usage : 30
						}, {
							name : '09-05',
							usage : 20
						}, {
							name : '09-06',
							usage : 50
						}, {
							name : '09-07',
							usage : 20
						}, {
							name : '09-08',
							usage : 10
						}, {
							name : '09-09',
							usage : 10
						}, {
							name : '09-10',
							usage : 10
						},{
							name : '09-11',
							usage : 5
						}, {
							name : '09-12',
							usage : 10
						}, {
							name : '09-13',
							usage : 20
						}, {
							name : '09-14',
							usage : 30
						}, {
							name : '09-15',
							usage : 20
						}, {
							name : '09-16',
							usage : 50
						}, {
							name : '09-17',
							usage : 20
						}, {
							name : '09-18',
							usage : 10
						}, {
							name : '09-19',
							usage : 10
						}, {
							name : '09-20',
							usage : 10
						}]
			});
	
		
		var tab1 = new Ext.Panel({
					id : "1",
					region : 'west',
					columnWidth:0.5,
					height : 300,
					items : {
								xtype : 'linechart',
								store : Store1,
								xField : 'name',
								xAxis: new Ext.chart.CategoryAxis({
						        title: '时间'
						    }),
						    yAxis: new Ext.chart.NumericAxis({
						        title: "数量"
						    }),
								series: [{
									yField: 'usage',
									style: {
										color: 0x88ff00,
										size: 4,
										lineSize: 1
									}
								}]
							}  
				});
		var tab2 = new Ext.Panel({
					id : "2",
					region : 'center',
					columnWidth:0.5,
					 height : 300,
					items : {
								xtype : 'linechart',
								store : Store2,
								xField : 'name',
								xAxis: new Ext.chart.CategoryAxis({
						        title: '时间'
						    }),
						    yAxis: new Ext.chart.NumericAxis({
						        title: "完成百分比"
						    }),
								series: [{
									yField: 'usage',
									style: {
										color: 0x11ff88,
										size: 4,
										lineSize: 1
									}
								}]
							}   
				});
		
  var southPanel = new Ext.Panel({
        layout : 'column',
        region : 'north',
        height : 300,
        items: [tab1,tab2]
    });			
	var centerPanel = new Ext.Panel({

        region : 'center',
        layout : 'border',
        tbar : [
								{
				            text:'设置',
				            iconCls: 'set' , 
										handler : function() {
											SetReportLine();
										}
				        }],
        items: [
        		southPanel,{
							region: 'center',
							layout : 'fit',
							title:'明细表格',
							items : [grid]
						}
        ]

			});
    
    


	return centerPanel;
}


function SetReportLine(){

		var states = [
		['0', '产线1'],
		['1', '产线2'],
		['2', '产线3'],
		['3', '产线4'],
		['4', '产线5'],
		['5', '产线6']
		];

	var myDate = new Date();
	var dw_day  = myDate.getDate();
  var dw_month = myDate.getMonth();
  var dw_year =  myDate.getYear();
  
  var nextyear = new Date(dw_year,dw_month,dw_day);  
  nextyear.setMonth(nextyear.getMonth() - 1);
  nextyear.setDate(nextyear.getDate()+ 1);
  if ( nextyear.getMonth() == myDate.getMonth()){
   nextyear.setDate(1);
  }

	var manager_north = {
		xtype: 'fieldset',
		margins:'5 5 5 5',
		layout : 'form',
		region:'center',
		bodyStyle : 'padding:10px;',
		items: [
		{
			xtype: 'datefield',
			name: 'start_date',
			id: 'start_date',
			fieldLabel: '起始日期',
      format:'Y-m-d',
      value:nextyear,
			anchor: '100%'
		},{
			xtype: 'datefield',
			name: 'end_date',
			id: 'end_date',
			fieldLabel: '结束日期',
      format:'Y-m-d',
      value:myDate,
			anchor: '100%'
		},{
								fieldLabel: '产线',
								xtype : 'combo',
								name : 'chanxian',
								frame : true,
								id : 'chanxian',
								store : new Ext.data.ArrayStore({
										fields : ['abbr', 'state'],
										data : states
									}),
								valueField : 'abbr',
								displayField : 'state',
								typeAhead : true,
								mode : 'local',
								triggerAction : 'all',
								value : '0',
								editable : false,
								anchor: '100%'
						}

		]
	};


	
	var managerWindows = new Ext.Window({
				layout : 'border',
				width : 400,
				height : 200,
				title : "设置",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'set',
				items : manager_north,
				plain : true
			});
	managerWindows.addButton({
				text : "生成报表",
				handler : function() {
				
					managerWindows.close();
				}
			});
	managerWindows.addButton({
				text : '取 消',
				handler : function() {
					managerWindows.close();
				}
			});
	managerWindows.show();


}


function GetLinkDevice(){


	var myData = [
			['1', '看板1', "生产线1", "1", "100",'30','28','正常'],
			['2', '看板2', "生产线2", "2", "200",'130','128','正常'],
			['3', '看板3', "生产线3", "3", "300",'230','228','正常'],
			['4', '看板4', "生产线4", "4", "400",'330','328','正常'],
			['5', '看板5', "生产线5", "5", "500",'430','428','正常']
		                                         
	];


	var store = new Ext.data.ArrayStore({
				fields : [{
							name : 'id'
						}, {
							name : 'name'
						}, {
							name : 'desc'
						}, {
							name : 'index'
						}, {
							name : 'total'
						}, {
							name : 'jihua'
						}, {
							name : 'shiji'
						}, {
							name : 'status'
						}]
			});
			
	store.loadData(myData);
	
	var sm = new Ext.grid.CheckboxSelectionModel();
	var grid = new Ext.grid.GridPanel({
				store : store,
				columns : [sm, {
							id : 'id',
							header : 'id',
							width : 10,
							sortable : true,
							dataIndex : 'id',
							hidden : true
						}, {
							header : '名称',
							width : 100,
							sortable : true,
							dataIndex : 'name'
						}, {
							header : '描述',
							width : 70,
							sortable : true,
							dataIndex : 'desc'
						}, {
							header : '台号',
							width : 70,
							sortable : true,
							dataIndex : 'index'
						}, {
							header : '总数',
							width : 70,
							sortable : true,
							dataIndex : 'total'
						}, {
							header : '计划数',
							width : 70,
							sortable : true,
							dataIndex : 'jihua'
						}, {
							header : '完成数',
							width : 70,
							sortable : true,
							dataIndex : 'shiji'
						}, {
							header : '状态',
							width : 70,
							sortable : true,
							dataIndex : 'status'
						}],
				sm : sm,

			
				stripeRows : true,
				autoExpandColumn : 'id',
				stateful : true,
				region : 'center',
				stateId : 'devicesgrid1'
			});


	var WeekTimeWindows = new Ext.Window({
				layout : 'border',
				width : 600,
				height : 300,
				title : "管理设备",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'server',
				items : [grid],
				plain : true
				
			});
	WeekTimeWindows.addButton({
				text : "确定",
				handler : function() {
					
					WeekTimeWindows.close();
				}
			});
	WeekTimeWindows.addButton({
				text : '取 消',
				handler : function() {
					WeekTimeWindows.close();
				}
			});
	WeekTimeWindows.show();
}